﻿<Window x:Name="_this" x:Class="z.v.sub.OrderSaleDetail"
		  xmlns:v_sub="clr-namespace:z.v.sub"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding Path=ID,StringFormat='Sale ID:{0}'}" Height="500" Width="500" Topmost="True" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="auto"/>
			<RowDefinition Height="342*"/>
		</Grid.RowDefinitions>
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="35*"/>
				<RowDefinition Height="32*"/>
				<RowDefinition Height="39*"/>
				<RowDefinition Height="463*"/>
			</Grid.RowDefinitions>
			<Grid Grid.Column="1" Grid.ColumnSpan="5" Grid.RowSpan="2">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="*"/>
					<ColumnDefinition Width="*"/>
					<ColumnDefinition Width="*"/>
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<Label Content="Nhận"/>
				<Label Content="Giao" Grid.Column="1"/>
				<Label Content="Thu" Grid.Column="2"/>
				<DatePicker SelectedDate="{Binding Date_N,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1"/>
				<DatePicker SelectedDate="{Binding Date_G,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="1"/>
				<DatePicker SelectedDate="{Binding Date_T,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="1"/>
			</Grid>
			<!--<Label Content="Hen" Grid.Column="2"/>
			<Label Content="Xong" Grid.Column="3"/>-->
			<Label Content="Ngày" Grid.Row="1"/>
			<Label Content="Ng Nhận" Grid.Row="2"/>
			<Label Content="Ng Giao" Grid.Column="2" Grid.Row="2"/>
			<Label Content="Ng Thu" Grid.Column="4" Grid.Row="2"/>
			<Label Content="Khách" Grid.ColumnSpan="1" Grid.Row="3"/>
			<v_sub:AutoComplete Tag="{Binding Employee_N,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ClassName="Employee" Single="True" Grid.Column="1" Grid.Row="2"/>
			<v_sub:AutoComplete Tag="{Binding Employee_G,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ClassName="Employee" Single="True" Grid.Column="3" Grid.Row="2"/>
			<v_sub:AutoComplete Tag="{Binding Employee_T,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ClassName="Employee" Single="True" Grid.Column="5" Grid.Row="2"/>
			<v_sub:AutoComplete Tag="{Binding Customer,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ClassName="Customer" Single="True" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="3"/>
			<Button x:Name="btnPrint" Grid.ColumnSpan="1" Content="In" Grid.Column="4" Grid.Row="3" Click="btnPrint_Click"/>
			<TextBlock Grid.Column="5" Grid.Row="3" TextWrapping="Wrap" Text="{Binding Path=Sum,Mode=OneWay}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
		</Grid>
		<DataGrid x:Name="tbl" Grid.Row="1" LostFocus="tbl_LostFocus" ItemsSource="{Binding Path=Order_Details}"
					 AutoGenerateColumns="False">
			<DataGrid.Columns>
				<DataGridTextColumn Binding="{Binding ID}" Header="ID" IsReadOnly="True" Width="Auto"/>
				<DataGridTemplateColumn Header="Máy" CanUserSort="True"  Width="2*">
					<DataGridTemplateColumn.CellEditingTemplate>
						<DataTemplate>
							<v_sub:AutoComplete ClassName="Product" Tag="{Binding Product,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Unloaded="AutoComplete_Unloaded_1"/>
						</DataTemplate>
					</DataGridTemplateColumn.CellEditingTemplate>
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding Product}"/>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>
				<DataGridTextColumn Binding="{Binding Quantity}"  Header="SL" Width="*"/>
				<DataGridTextColumn Binding="{Binding Price,Mode=TwoWay}"  Header="Giá" Width="*"/>
				<DataGridTextColumn Binding="{Binding Path=Total,Mode=OneWay}"  Header="Tổng" IsReadOnly="True" Width="Auto"/>
				<DataGridTextColumn Binding="{Binding Note}"  Header="Ghi chú" Width="2*"/>
			</DataGrid.Columns>
		</DataGrid>
	</Grid>
</Window>
